package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.aids_malaria.http.response.AreaV;
import com.aids_malaria.http.response.PersonData;

import java.util.ArrayList;
import java.util.List;

@Dao
public interface PersonDataDao {
    @Query("delete from personData")
    int deleteAll();

    @Delete
    int delete(PersonData user);

    @Query("SELECT * FROM personData")
    List<PersonData> getAll();

    @Query("SELECT * FROM personData WHERE createOrUpdate =:isCreateUpdate")
    List<PersonData> getAllByCreateUpdate(boolean isCreateUpdate);

    @Query("SELECT * FROM personData WHERE identity_code IN (:identity_code)")
    List<PersonData> findById(String identity_code);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<PersonData> users);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(PersonData users);

    @Update()
    int update(PersonData user);
}
